// Map 数据结构  类似于对象
// 对象添加的键会默认转换为字符串
const obj = {};
obj[true] = 'value';
obj[123] = 'value';
obj[{ a: 1 }] = 'value';

console.log(Object.keys(obj));
// [ '123', 'true', '[object Object]' ]

// value
console.log(obj['[object Object]']);

const m = new Map();

const tom = { name: 'tom' };

m.set(tom, 90);

console.log(m.get(tom));

console.log(m.has(tom));

console.log(m.delete(tom));

console.log(m.size);

m.set(tom, 30);
m.set('name', 'cuvee');

console.log(m.size);
console.log('-----------');

m.forEach((i, j) => console.log(i, j));

for (const i of m) {
  console.log(i);
}

console.log(m.entries());
console.log(m.keys());
console.log(m.values());

console.log(m.clear());
